import type { Test } from "@server/src/schemas/tests";
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion";

export function TestsError({ test }: { test: Test }) {
  return (
    <Accordion
      type="single"
      collapsible
      defaultValue="message"
      className="border-b bg-destructive/10"
    >
      <AccordionItem value="message" className="px-4 py-2">
        <AccordionTrigger className="p-0 text-destructive text-sm">Status Message</AccordionTrigger>
        <AccordionContent className="p-0 text-xs">
          <pre className="text-wrap">{test.statusMessage}</pre>
        </AccordionContent>
      </AccordionItem>
      <AccordionItem value="trace" className="px-4 py-2">
        <AccordionTrigger className="p-0 text-destructive text-sm">Status Trace</AccordionTrigger>
        <AccordionContent className="py-2 text-xs">
          <pre className="text-wrap">{test.statusTrace}</pre>
        </AccordionContent>
      </AccordionItem>
    </Accordion>
  );
}
